dojo.provide("dojoscratch.CircleCommand");

dojo.require("dojoscratch.AbstractCommand");

dojo.declare("dojoscratch.CircleCommand", dojoscratch.AbstractCommand, {
	_command: function() {
		var dx = Math.abs(this._x1 - this._x2);
		var dy = Math.abs(this._y1 - this._y2);
		//or max:
		var radius = Math.min(dx, dy)/2;
		var circle = {
			"type" : "circle",
			"cx" : Math.min(this._x1, this._x2) + dx/2,
			"cy" : Math.min(this._y1, this._y2) + dy/2,
			"r" : radius
		};
		var fill = {
			colors : {
				color : "gray"
			}
		};
		var stroke = {
				colors : "black",
				width: 2
		};
		
		this._createScratch(circle, fill, stroke);
	}
});